<template>
    <div class="school">
        <h2>学校名称：{{ school.name }}</h2>
        <h2>学校地址：{{ school.address }}</h2>
        <input type="text" v-model="school.level">
        <h2>教师姓名：{{ school.tname }}</h2>
        <hr>
        <Teacher @get-tname="getTname"/>
        <hr>
        <Student name="李四" sex="男" :age="20"/>
    </div>
</template>



<script setup>
import { computed, provide, reactive } from 'vue';
import Student from './components/Student.vue';
import Teacher from './components/Teacher.vue';
const school=reactive({
    name:'华南商贸',
    address:'广州白云',
    level:'本科',
    tname:''
})

provide('levelKey',computed(()=>school.level))//添加响应式

function getTname(val){
    school.tname=val
}


</script>



<style scoped></style>